package com.tinyspot.concrete.jpa.service.impl;

import com.tinyspot.concrete.jpa.dao.OrderDao;
import com.tinyspot.concrete.jpa.entity.Order;
import com.tinyspot.concrete.jpa.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Tinyspot
 * @date 2022-12-24 20:19
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderDao orderDao;

    @Override
    public List<Order> findAll() {
        return orderDao.findAll();
    }

    @Override
    public Order findOrderById(Integer id) {
        return orderDao.findById(id).get();
    }

    @Override
    public void save(Order order) {
        orderDao.save(order);
    }

    @Override
    public void update(Order order) {
        orderDao.save(order);
    }

    @Override
    public void delete(Integer id) {
        orderDao.deleteById(id);
    }
}
